home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / lisp / clue.lha / clue / examples / old / demo / graph-data.l < prev    next >
Encoding:
Text File  |  1989-07-12  |  2.2 KB  |  69 lines

  1. ;;; -*- Mode:Lisp; Package:USER; Syntax:Common-Lisp; Base:10; Lowercase:T -*-
  2.  
  3. ;;;
  4. ;;;             TEXAS INSTRUMENTS INCORPORATED
  5. ;;;                  P.O. BOX 2909
  6. ;;;                   AUSTIN, TEXAS 78769
  7. ;;;
  8. ;;; Copyright (C) 1988 Texas Instruments Incorporated.
  9. ;;;
  10. ;;; Permission is granted to any individual or institution to use, copy, modify,
  11. ;;; and distribute this software, provided that this complete copyright and
  12. ;;; permission notice is maintained, intact, in all copies and supporting
  13. ;;; documentation.
  14. ;;;
  15. ;;; Texas Instruments Incorporated provides this software "as is" without
  16. ;;; express or implied warranty.
  17. ;;;
  18.  
  19. ;;; Change History:
  20. ;;;
  21. ;;; ----------------------------------------------------------------------------
  22. ;;;  7/13/88   SLM   Created.
  23.  
  24. (in-package 'user)
  25.  
  26. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  27. ;;; Sample data for Graph Demo
  28.  
  29. (defstruct graph-sample
  30.   (name nil)
  31.   (parents nil)
  32.   (children nil))
  33.  
  34. (defvar sample (make-graph-sample :name 'sample
  35.                   :children '(first-child second-child)))
  36. (defvar first-child (make-graph-sample :name 'first-child
  37.                        :parents '(sample)
  38.                        :children '(grandchild-a grandchild-b grandchild-c)))
  39. (defvar second-child (make-graph-sample :name 'second-child
  40.                     :parents '(sample)
  41.                     :children '(grandchild-b grandchild-d)))
  42. (defvar grandchild-a (make-graph-sample :name 'grandchild-a
  43.                        :parents '(first-child)))
  44. (defvar grandchild-b (make-graph-sample :name 'grandchild-b
  45.                        :parents '(first-child second-child)))
  46. (defvar grandchild-c (make-graph-sample :name 'grandchild-c
  47.                        :parents '(first-child)))
  48. (defvar grandchild-d (make-graph-sample :name 'grandchild-d
  49.                        :parents '(second-child)))
  50.  
  51. (defun sample-children (struct)
  52.   (if (symbolp struct)
  53.       (graph-sample-children (eval struct))
  54.       (graph-sample-children struct)))
  55.  
  56. (defun sample-parents (struct)
  57.   (if (symbolp struct)
  58.       (graph-sample-parents (eval struct))
  59.       (graph-sample-parents struct)))
  60.  
  61. (defun simple-graph-demo (display)
  62.   (clue-examples::nodes-n-edges-driver
  63.     display
  64.     '(sample)
  65.     :edge-info '((:isa (:children sample-children)
  66.                (:parents sample-parents) ))
  67.     :vertex-info '((:border-width 3))))
  68.  
  69.